package com.example.produces.service.impl;

import com.example.produces.entity.User;
import com.example.produces.mapper.UserMapper;
import com.example.produces.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class UserImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public List<User> findAll() {
        List<User> users=userMapper.findAll();
        return users;
    }

    @Override
    public void Add(User user) {
       userMapper.Add(user);
    }

    @Override
    public User findOne(String name) {
        User user=userMapper.findOne(name);
        return user;
    }

    @Override
    public void upDate(User user) {
          userMapper.upDate(user);
    }
}
